package org.laizili.solution.leetcode;

import org.laizili.structure.tree.bitree.TreeNode;

/**
 * <a href="https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/">104. 二叉树的最大深度</a>
 * <p>
 * tags: 二叉树; 递归
 * </p>
 */
public class Problem104 {
    private static class Solution {
        public int maxDepth(TreeNode root) {
            if (root == null) {
                return 0;
            }
            return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
        }
    }
}
